<?php

namespace common\models\base;

use Yii;

/**
 * This is the model class for table "{{%file_list_download_log}}".
 *
 * @property int $id
 * @property int $file_list_info_id
 * @property int $file_list_notice_id
 * @property int $created_at
 * @property int $is_success
 * @property string $back_detail
 *
 * @property FileListNotice $fileListNotice
 * @property FileListInfo $fileListInfo
 */
class FileListDownloadLog extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%file_list_download_log}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['file_list_info_id', 'file_list_notice_id', 'created_at', 'is_success'], 'integer'],
            [['created_at'], 'required'],
            [['back_detail'], 'string'],
            [['file_list_notice_id'], 'exist', 'skipOnError' => true, 'targetClass' => FileListNotice::className(), 'targetAttribute' => ['file_list_notice_id' => 'id']],
            [['file_list_info_id'], 'exist', 'skipOnError' => true, 'targetClass' => FileListInfo::className(), 'targetAttribute' => ['file_list_info_id' => 'id']],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'file_list_info_id' => Yii::t('app', 'File List Info ID'),
            'file_list_notice_id' => Yii::t('app', 'File List Notice ID'),
            'created_at' => Yii::t('app', 'Created At'),
            'is_success' => Yii::t('app', 'Is Success'),
            'back_detail' => Yii::t('app', 'Back Detail'),
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getFileListNotice()
    {
        return $this->hasOne(FileListNotice::className(), ['id' => 'file_list_notice_id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getFileListInfo()
    {
        return $this->hasOne(FileListInfo::className(), ['id' => 'file_list_info_id']);
    }
}
